﻿@model Shake.Framework.Dto.MenuTemplate
@if (Model != null)
{
    <ul class="layui-nav layui-nav-tree" lay-filter="demo">

        @foreach (var menu in Model.Menus)
        {
            <li class="layui-nav-item">
                <a href="@(menu.HasChildMenu ? "javascript:void(0);" : menu.Link)" target="@(menu.IsOpenNewTab ? "_blank" : string.Empty)">
                    @if (menu.Icon != string.Empty)
                    {
                        @Html.Raw(menu.Icon)
                    }
                    @menu.Name
                </a>

                @if (menu.HasChildMenu)
                {
                    <dl class="layui-nav-child">
                        @foreach (var childMenu in menu.ChildMenus)
                        {
                            <dd class="layui-nav-child layui-this">
                                <a href="@childMenu.Link" target="@(childMenu.IsOpenNewTab ? "_blank" : string.Empty)">
                                    @if (childMenu.Icon != string.Empty)
                                    {
                                        @Html.Raw(childMenu.Icon)
                                    }
                                    @childMenu.Name
                                </a>
                            </dd>
                        }
                    </dl>
                }
            </li>
        }

    </ul>
}